// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

const RouteView = {
	name: 'RouteView',
	render: h => h('router-view')
}

export const asyncRouterMap = [
	{
		path: '/',
		name: 'index',
		component: BasicLayout,
		meta: { title: 'menu.home' },
		redirect: '/dashboard/workplace',
		children: [
			// dashboard
			{
				path: '/dashboard',
				name: 'dashboard',
				redirect: '/dashboard/workplace',
				component: RouteView,
				meta: { title: 'menu.dashboard', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] },
				children: [
					{
						path: '/dashboard/workplace',
						name: 'Workplace',
						component: () => import('@/views/dashboard/Workplace'),
						meta: { title: 'menu.dashboard.workplace', keepAlive: false, permission: ['dashboard'] }
					},
					{
						path: '/dashboard/analysis/:pageNo([1-9]\\d*)?',
						name: 'Analysis',
						component: () => import('@/views/dashboard/Analysis'),
						meta: { title: 'menu.dashboard.analysis', keepAlive: false, permission: ['dashboard'] }
					},
				]
			},
			// Exception
			{
				path: '/exception',
				name: 'exception',
				component: RouteView,
				redirect: '/exception/403',
				hidden: true,
				meta: { title: 'menu.exception', icon: 'warning', permission: ['exception'] },
				children: [
					{
						path: '/exception/403',
						name: 'Exception403',
						component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
						meta: { title: 'menu.exception.not-permission', permission: ['exception'] }
					},
					{
						path: '/exception/404',
						name: 'Exception404',
						component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
						meta: { title: 'menu.exception.not-find', permission: ['exception'] }
					},
					{
						path: '/exception/500',
						name: 'Exception500',
						component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
						meta: { title: 'menu.exception.server-error', permission: ['exception'] }
					}
				]
			},

		]
	},
	{
		path: '*',
		redirect: '/404',
		hidden: true
	}
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
	{
		path: '/user',
		component: UserLayout,
		redirect: '/user/login',
		hidden: true,
		children: [
			{
				path: 'login',
				name: 'login',
				component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
			}
		]
	},

	{
		path: '/404',
		component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
	}
]
